Skip to content

fix(test): configure git user.email/name in integration setup#13

Merged
b2l merged 1 commit into
mainfrom
fix/git-user-config-in-integration-tests
Apr 15, 2026
Merged

fix(test): configure git user.email/name in integration setup#13
b2l merged 1 commit into
mainfrom
fix/git-user-config-in-integration-tests

Conversation

@b2l
Copy link
Copy Markdown
Owner

@b2l b2l commented Apr 15, 2026

Summary

Main is red because the detached-HEAD integration test calls `git commit --allow-empty` without setting `user.email` / `user.name`. On my machine that's fine (globally configured); on CI runners it isn't. `.quiet()` suppresses the failure, so the subsequent `git checkout --detach` has no commit to detach to, HEAD stays on main, and the assertion fails.

Fix: set identity locally on the test repo in `beforeAll`, so every `git commit` in the suite works regardless of ambient config. Chose repo-local config over global so we don't leak test identity into a contributor's shell.

Verification

```sh
GIT_CONFIG_GLOBAL=/dev/null bun test src/shared/repository/
```

Simulates a bare CI runner with no global git config. All 15 tests pass.

Why this slipped past local dev

Locally everyone (including agents running under my env) has `user.email` globally set. The CI runner is the first environment without it. Worth remembering for any future `git commit` in integration tests — prefer explicit local config over ambient.

Integration test "returns undefined on detached HEAD" calls
`git commit --allow-empty`. That fails on CI runners without a
global user.email/user.name configured — `.quiet()` hides the error,
so the subsequent checkout --detach has no commit to detach to, HEAD
stays on main, and the test assertion fails.

Set identity locally on the test repo in beforeAll so every commit
works regardless of ambient git config. Verified by running the tests
with GIT_CONFIG_GLOBAL=/dev/null (simulates a bare CI runner).
@b2l b2l merged commit 83f9cde into main Apr 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant